package com.cn.zpark;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: com.cn.zpark
 * @ClassName: MyServletDemo03
 * @Description:
 * @author: RZS
 * @date: 2022/4/6  16:38
 */
@WebServlet(urlPatterns = {"/mys3.do", "/mys3.html"}, loadOnStartup = 1)
public class MyServletDemo03 extends HttpServlet {
    // 当servlet被访问是调用的方法
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("MyServletDemo03的service方法被执行");
    }

    // 当servlet实例被初始化时调用的方法
    @Override
    public void destroy() {
        System.out.println("MyServletDemo03被销毁");
    }

    // 当servlet实例被销毁时调用的方法
    @Override
    public void init() throws ServletException {
        System.out.println("MyServletDemo03被初始化");
    }
}
